package pattern12.overtime;

/**
 * 工作类
 *
 * @author wdl
 */
public class Work {
    /**
     * 工作的时间点
     */
    private int hour;
    /**
     * 工作是否已经完成
     */
    private boolean finishWork;

    /**
     * 工作的状态
     *
     */
    private IState state;

    /**
     * 初始化工作状态
     * @param state 初始化状态
     */
    public Work(IState state){
        this.state=state;
    }

    public void setHour(int hour) {
        this.hour = hour;
    }

    public int getHour() {
        return hour;
    }

    public boolean isFinishWork() {
        return finishWork;
    }

    public void setFinishWork(boolean finishWork) {
        this.finishWork = finishWork;
    }

    public IState getState() {
        return state;
    }

    public void setState(IState state) {
        this.state = state;
    }

    /**
     * 写代码
     */
    public void writeProgram(){
        state.writeProgram(this);
    }
}
